package bb.lanxing.util.ui;

import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import kotlin.jvm.internal.Intrinsics;

public final class RecyclerViewSpaceItemDecoration extends RecyclerView.ItemDecoration {
    private final int space;
    private final int spanCount;

    public RecyclerViewSpaceItemDecoration(int i, int i2) {
        this.space = i;
        this.spanCount = i2;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        Intrinsics.checkNotNullParameter(outRect, "outRect");
        Intrinsics.checkNotNullParameter(view, "view");
        Intrinsics.checkNotNullParameter(parent, "parent");
        Intrinsics.checkNotNullParameter(state, "state");
        outRect.left = this.space;
        outRect.bottom = this.space;
        if (parent.getChildLayoutPosition(view) % this.spanCount == 0) {
            outRect.left = 0;
        }
    }
}